package ru.st.selenium.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.alertIsPresent;
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class ResultFilmPage extends InternalPage {

	public ResultFilmPage(PageManager pages) {
		super(pages);
	}
	
  @FindBy(css="div.maininfo_full")
  private WebElement titleField;
	
  @FindBy(css="img[src$='delete.png']")
  private WebElement removeButton;
   
  public ResultFilmPage clickRemoveButton() {
	  removeButton.click();
	    wait.until(alertIsPresent()).accept();
	    return this;
	  }

  public FilmPage ensurePageLoaded() {
	    super.ensurePageLoaded();
	    wait.until(presenceOfElementLocated(By.cssSelector("div.maininfo_full")));
	    return this;
  }
}

